import requests
import os
import base64
def main():
   imagepath=os.path.abspath('.')+"\\image\\"
   imagefiles=os.listdir(imagepath)
   for image in imagefiles:
       imagefile=imagepath+image
       with  open(imagefile,"rb") as fs:
          imagebase64=str(base64.b64encode(fs.read()),"utf-8")
          headers = { 'Content-Type': 'application/json'}
          response = requests.post('http://127.0.0.1:5000/PaddleOCR/DetectText', headers=headers, json=imagebase64)
          print(response.content) 
if __name__=="__main__":
    main();